<!DOCTYPE html>
[#assign ctx=springMacroRequestContext.contextPath/]
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>在线金融产品交易平台</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="${ctx!}/statics/css/font.css">
    <link rel="stylesheet" href="${ctx!}/statics/css/login.css">
    <link rel="stylesheet" href="${ctx!}/statics/css/xadmin.css">
    <script type="text/javascript" src="${ctx}/statics/layui/layui.js"></script>
    <script src="${ctx}/statics/js/jquery-3.6.0.js"></script>
</head>
<body class="login-bg">

<div class=" login layui-anim layui-anim-up">
    <div class="message">在线金融产品交易平台账号注册</div>
    <div id="darkbannerwrap"></div>

    <form method="post" class="layui-form" >
        <div class="layui-form-item">
            <label>用户名:</label>
            <div class="layui-form-block">
                <input type="text" name="username" required lay-verify="required"
                       placeholder="请输入用户名" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label>密码:</label>
            <div class="layui-form-block">
                <input type="password" name="password" required lay-verify="required"
                       placeholder="请输入密码" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-form-block">
                <button class="layui-btn" lay-submit lay-filter="loginForm">注册</button>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer;
        var form = layui.form;

        form.on('submit(loginForm)', function (data) {
            // submit login data
            var username = data.field.username;
            var password = data.field.password;
            $.post("/registAccount", {username, password}, res=>{
                switch (res.code) {
                    case 200:
                        layer.alert(res.msg, {icon:1},function () {
                            window.location.href = "/login";
                        });
                        break;
                    case 500:
                        layer.alert(res.msg, {icon:2});
                        break;
                }

            });
            return false;
        })
    })
</script>
</body>
</html>